package com.itCar.base.api.file.controller;

import com.itCar.base.api.file.service.FileService;
import com.itCar.base.config.result.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @ClassName: FileController
 * @Description: TODO
 * @author: liuzg
 * @Date: 2022/9/14 14:29
 * @Week: 星期三
 * @Version: v1.0
 */
@RestController
@RequestMapping(value = "/admin/file", produces = "application/json")
@Api(tags = "文件")
public class FileController {

    @Resource
    private FileService fileService;

    @PostMapping(value = "/fileCovert")
    @ApiOperation(value = "文件互转")
    public ResultBody fileCovert(@RequestParam(value = "file", required = true) MultipartFile file){
        return ResultBody.success(fileService.fileCovert(file));
    }

//    @PostMapping(value = "/pw")
//    @ApiOperation(value = "pdf转word")
//    public ResultBody pdf_word(@RequestParam(value = "file", required = true) MultipartFile file) {
//        String path = fileService.pw(file);
//        return ResultBody.success(path);
//    }
//
//    @PostMapping(value = "/wp")
//    @ApiOperation(value = "word转pdf")
//    public ResultBody word_pdf(@RequestParam(value = "file", required = true) MultipartFile file) {
//        String path = fileService.wp(file);
//        return ResultBody.success(path);
//    }
}
